# coding:utf-8
# __auth__ = Felix7157

from selenium import webdriver
from selenium.webdriver.common.by import By
import time

search_input_loc = (By.ID, '//*[@id="s_kw_wrap"]/input')
search_button_loc = (By.ID, 'su')

def test_baidu_search_01():
    driver = webdriver.Chrome()                            # 定义一个浏览器
    driver.get('https://www.baidu.com/')                   # 打开百度
    driver.find_element(*search_input_loc).send_keys('NBA')      # 搜索框输入值
    driver.find_element(*search_button_loc).click()               # 点击搜索
    time.sleep(1)


def test_baidu_search_02():
    driver = webdriver.Chrome()
    driver.get('https://www.baidu.com/')
    driver.find_element(*search_input_loc).send_keys('NBA')
    driver.find_element(*search_button_loc).click()
    time.sleep(1)
    driver.find_element(*search_input_loc).clear()               # 清空输入框
    driver.find_element(*search_input_loc).send_keys('淘宝')
    driver.find_element(*search_button_loc).click()
    time.sleep(1)


def test_baidu_search_03():
    driver = webdriver.Chrome()
    driver.get('https://www.baidu.com/')
    driver.find_element(*search_input_loc).send_keys('NBA')
    driver.find_element(*search_button_loc).click()
    time.sleep(1)
    driver.find_element(*search_input_loc).clear()
    driver.find_element(*search_input_loc).send_keys('淘宝')
    driver.find_element(*search_button_loc).click()
    time.sleep(1)
    driver.find_element(*search_input_loc).clear()
    driver.find_element(*search_input_loc).send_keys('京东')
    driver.find_element(*search_button_loc).click()
    time.sleep(1)
